Learn R Programming

bnlearn (version 3.1)

graph integration: Import and export networks from the graph package

Description

Convert bn and bn.fit objects to graphNEL and graphAM objects and vice versa.

Usage

## S3 method for class 'graphNEL':
as.bn(x)
## S3 method for class 'graphAM':
as.bn(x)
## S3 method for class 'bn':
as.graphNEL(x)
## S3 method for class 'bn.fit':
as.graphNEL(x)
## S3 method for class 'bn':
as.graphAM(x)
## S3 method for class 'bn.fit':
as.graphAM(x)

Arguments

x
an object of class bn, bn.fit, graphNEL, graphAM.

Value

  • An object of the relevant class.

Examples

Run this code
library(graph)
a = bn.fit(hc(learning.test), learning.test)
b = as.graphNEL(a)
c = as.bn(b)
identical(as.graphNEL(a), as(a, "graphNEL"))

Run the code above in your browser using DataLab